import { Controller, Post, Param, Request } from '@nestjs/common';
import { LikeService } from './like.service';
import { ApiOperation } from '@nestjs/swagger';

@Controller('like')
export class LikeController {
  constructor(private readonly likeService: LikeService) {}

  @Post(':videoId')
  @ApiOperation({ summary: '用户点赞视频接口' })
  async toggleLike(@Param('videoId') videoId: string, @Request() req) {
    const result = await this.likeService.toggleLike(req.user.id, videoId);
    return { is_liked: result };
  }
}
